package com.szl.group.exception;

import com.szl.group.common.enums.ResultCodeEnum;
import lombok.Data;

@Data
public class BusinessException extends RuntimeException {

    private Integer code;
    private String errorReason;

    public BusinessException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }

    public BusinessException(Integer code, String msg, String errorReason) {
        super(msg);
        this.code = code;
        this.errorReason = errorReason;
    }

    public BusinessException(ResultCodeEnum responseCodeEnum, String msg) {
        super(msg);
        this.code = responseCodeEnum.getCode();
    }

    public BusinessException(ResultCodeEnum responseCodeEnum, String msg, String errorReason) {
        super(msg);
        this.code = responseCodeEnum.getCode();
        this.errorReason = errorReason;
    }

}